﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;

namespace CharacterCreation.Business.ViewModels
{
    public abstract class ViewModelBase
    {
        [Display(AutoGenerateField = false)]
        public Guid Id { get; set; }

        public string Title { 
            get {
                var display = (DescriptionAttribute)this.GetType().GetCustomAttributes(typeof(DescriptionAttribute), true).FirstOrDefault();
                if (display != null)
                {
                    return display.Description;
                }
                else
                {
                    return this.GetType().Name;
                }
            } 
        }
    }
}
